home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / MSG Graphic Effects 1.0 Source / Two corner.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-23  |  2.1 KB  |  62 lines  |  [TEXT/KAHL]

  1. /*******************************************************************************
  2.  * Copyright © 1992-1993 Mark Pilgrim                                          *
  3.  *                                                                             *
  4.  * This file is provided as is, and may be freely distributed unaltered.  This *
  5.  * message must accompany any copy of this file.  This file may be used or     *
  6.  * modified for use for a non-commercial product provided that appropriate     *
  7.  * credit is given to the author named above.                                  *
  8.  * Commercial use of this source code is prohibited.                           *
  9.  ******************************************************************************/
  10.  
  11. #include "msg misc.h"
  12. #include "msg timing.h"
  13.  
  14. #define BlockSize 10
  15. #define CorrectTime 3
  16.  
  17. void TwoCorner(GrafPtr);
  18.  
  19. /* One region starts at the top of the screen and moves down the right side
  20.    (making triangles with the topleft of the screen).  The other region starts
  21.    at the bottom of the screen and moves up the left side (making triangles with
  22.    the bottomright of the screen). */
  23.    
  24. void TwoCorner(GrafPtr sourceGrafPtr)
  25. {
  26.     RgnHandle    curregion;
  27.     Rect        source;
  28.     int            gap;
  29.     
  30.     curregion=NewRgn();
  31.     source.top=source.left=0;
  32.     source.bottom=MAIN_WINDOW_HEIGHT;
  33.     source.right=MAIN_WINDOW_WIDTH;
  34.     
  35.     gap=0;
  36.     do
  37.     {
  38.         StartTiming();
  39.         SetEmptyRgn(curregion);
  40.         MoveTo(0,0);
  41.         OpenRgn();
  42.             Line(MAIN_WINDOW_WIDTH,gap);
  43.             Line(0,BlockSize);
  44.             LineTo(0,0);
  45.             MoveTo(MAIN_WINDOW_WIDTH,MAIN_WINDOW_HEIGHT);   /* region is discontinuous */
  46.             Line(-MAIN_WINDOW_WIDTH,-gap);                  /* but this is much faster */
  47.             Line(0,-BlockSize);                             /* than two regions & two  */
  48.             LineTo(MAIN_WINDOW_WIDTH,MAIN_WINDOW_HEIGHT);   /* CopyBits */
  49.         CloseRgn(curregion);
  50.         CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
  51.             &source, &source, 0, curregion);
  52.         gap+=BlockSize;
  53.         TimeCorrection(CorrectTime);
  54.     }
  55.     while (gap<MAIN_WINDOW_HEIGHT+BlockSize);
  56.     
  57.     CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
  58.         &source, &source, 0, 0L);   /* in case we missed any bits */
  59.     
  60.     DisposeRgn(curregion);
  61. }
  62.